Skip to content

Let mouse wheel zoom snap to view resolution levels - #7210

Merged
solth merged 2 commits into
kitodo:mainfrom
effective-webwork:mouse-wheel-zoom-steps-fix-4244
Sep 17, 2026
Merged

solth merged 2 commits into
kitodo:mainfrom
effective-webwork:mouse-wheel-zoom-steps-fix-4244

Conversation

@solth

@solth solth commented Aug 27, 2026

Copy link
Copy Markdown
Member

Fixes #4244 by using option constrainResolution to link mouse wheel "steps" to zoom levels in OpenLayer map of gallery detail view.

Note: I will open backports of this fix for Kitodo 3.9.x and 4.0.x once this pull request is approved

@codacy-production

codacy-production Bot commented Aug 27, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@solth
solth requested a review from oliver-stoehr August 27, 2026 09:12
@solth
solth force-pushed the mouse-wheel-zoom-steps-fix-4244 branch 3 times, most recently from 66c7420 to b5c8c5d Compare August 31, 2026 09:30
Comment on lines +356 to +362
showFullExtent: true,
padding: [20, 20, 20, 20]
padding: [20, 20, 20, 20],
constrainResolution: true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and did not notice a real difference with regard to the necessary mouse scrolls. Setting zoomFactor to 1.3 had more effect on the aspects @matthias-ronge seems to talk about in the issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this and did not notice a real difference with regard to the necessary mouse scrolls. Setting zoomFactor to 1.3 had more effect on the aspects @matthias-ronge seems to talk about in the issue.

Really? That's interesting - and exactly the opposite of what I have observed!

Zooming 10 "ticks" in the current main branch looks like this:

issue-4244-main.mov

Zooming 10 "ticks" with zoomFactor: 1.3:

issue-4244-zoom-factor-1-3.mov

Zooming 10 "ticks" with constrainResolution: true:

issue-4244-constrain-resolution.mov

I am using Firefox, version 154 on MacOS 26.6.3 (Tahoe), btw.

@BartChris maybe have to reload your browsers cache to see the real difference with using contrainResolution?

@solth
solth force-pushed the mouse-wheel-zoom-steps-fix-4244 branch 3 times, most recently from 752a0fe to e56d750 Compare September 10, 2026 11:22

@oliver-stoehr oliver-stoehr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works fine with Chrome, Firefox, Edge and Safari (macOS).

@BartChris

BartChris commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

I will try to check if i just made a setup error. You are on MacOS? Are you using mousewheel or touchpad?

@solth

solth commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

I will try to check if i just made a setup error. You are on MacOS? Are you using mouswheel or touchpad?

I am using the mouse wheel, @oliver-stoehr is probably using the touchpad, I guess.

@oliver-stoehr

Copy link
Copy Markdown
Collaborator

Yes, I'm using macOS with touchpad.

@solth
solth force-pushed the mouse-wheel-zoom-steps-fix-4244 branch from e56d750 to d9bab33 Compare September 16, 2026 15:17
@BartChris

Copy link
Copy Markdown
Collaborator

Hmm, both of you can confirm an improvement, so this is strange. I am on Ubuntu Linux and what makes the difference there is setting to zoomFactor: 1.3 independent of the browser. It would be interesting to see what happens on Windows. Would it maybe be an option to do both settings? Or maybe @thomaslow or @henning-gerhardt can test what happens on their systems.

@henning-gerhardt

Copy link
Copy Markdown
Collaborator

I know that Firefox at least has an option called "Use smooth scrolling". I had disabled this as I want a fast scrolling. Maybe this setting has some kind of influence. I can try this changes tomorrow.

@solth

solth commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Would it maybe be an option to do both settings?

I think that's a good idea to cover all bases. I will add both settings and check whether it has any adverse effects on how the zoom feature works for me. Maybe you can do the same for your setup and confirm that it works for you, too.

@BartChris

Copy link
Copy Markdown
Collaborator

There seems to be some device specific stuff going on, especially in OpenLayers version 6 which we are appearantly using:
openlayers/openlayers#15423

@BartChris

BartChris commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Setting it to to 1.2 is already good enough for me

scroll_1_2_new.mp4

compared to main (1.1)

scroll_1_1.mp4

@solth

solth commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Setting it to to 1.2 is already good enough for me

And that is with setting constrainResolution as well?

@BartChris

BartChris commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Setting it to to 1.2 is already good enough for me

And that is with setting constrainResolution as well?

Yes, constrainResolution has no visible effect for me, but i suppose it is important what happens on Windows. I will try to set those things on our production systems and let my colleagues test in Windows.

Edit:
i have to correct myself. When adding constrainResolution (in combination with zoom 1.2) things seem even faster

scroll_1_2_constrain.mp4

Changing only constrainResolution has no visible effect over main as far as i can see:

constrain_1_1.mp4

Edit: Given the evidence from only my machine i would vote for zoomFactor: 1.2 and constrainResolution: true.

@thomaslow

Copy link
Copy Markdown
Member

For me, zooming is a bit slow in the current main branch, but still usable. I would call it "precise". It is definitely way faster than @solth video. It looks to be the same as @BartChris video. Increasing zoomFactor to 1.2 would be an improvement for my devices (Fedora, Windows, Firefox, Chrome with basic Logitech Mouse).

Looking at the documentation of OpenLayers, the purpose of the setting constrainResolution: true is to enable auto-zooming to the closest pre-defined resolution level (or zoom level). When setting it to true, we should also specify a list of predefined resolutions. I guess, by default, if none are provided, some reasonable resolutions are auto-calculated somehow, which is why zooming may be different for some people (or not) with this setting (jumping from one auto-calculated resolution level to the next).

I think adjusting the zoomFactor would be better. Given that there are many different devices out there, maybe this can be a user setting in the future, e.g. with a interactive slider ranging from 1.05 to 1.5? Then, everybody can decide on their own.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@solth

solth commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

I think adjusting the zoomFactor would be better. Given that there are many different devices out there, maybe this can be a user setting in the future, e.g. with a interactive slider ranging from 1.05 to 1.5? Then, everybody can decide on their own.

Sounds like a good plan for the future. But I take it that you don't opose merging the current pull request as it is as a first step then? This could also be backported to 3.9.x and 4.0.x, while adding a new setting to the individual metadata editor configuration (which I support in general!) is something that would require a database migration and thus would not be eligible for a backport, and could therefor be added to the next major version (e.g. 4.1.0, for example)

@thomaslow

Copy link
Copy Markdown
Member

But I take it that you don't opose merging the current pull request

I am not opposed. Hopefully, this PR should improve things. Apparently, my system is not really affected by this. Both zoomFactor 1.1 and 1.2 work fine for me. One is a bit faster than the other. With contrainResolution: true zooming is even faster, but still perfectly fine. Personally I would prefer 1.2 with contrainResolution: false (see below). But I guess, maybe, there are other systems where this change is perceived by users as making things worse, I don't know.

One additional observation: In Windows, there is a setting at "Einstellungen -> Bluetooth und Geräte -> Maus -> Zeilen, die gleichzeitig gescrollt werden sollen" which controls how fast pages are scrolled with a mouse wheel. With constrainResolution: true, it does not matter whether you choose 1 (minimum) or 100 (maximum). The zoom behavior in OpenLayers is the same. With constrainResolution: false, this setting also influences the zoom speed. Again, this could be an advantage or disadvantage for some users, depending on their preferences.

@solth

solth commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

Personally I would prefer 1.2 with contrainResolution: false (see below). But I guess, maybe, there are other systems where this change is perceived by users as making things worse, I don't know.

Leaving constrainResolution: false results in a larger zoomFactor having next to no effect at all for me, so I am going to merge this pull request with both settings adjusted. It should be an improvement on the current situtation for most users and can be the start of further, incremental enhancements.

@henning-gerhardt

Copy link
Copy Markdown
Collaborator

I tried this current changes and there are no big differences for me. It is maybe a little bit faster but no big difference. I did not use this feature very often - until this pull request only once or twice, so my impression could be wrong.

@solth
solth merged commit 9278140 into kitodo:main Sep 17, 2026
6 checks passed
@solth
solth deleted the mouse-wheel-zoom-steps-fix-4244 branch September 17, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mousewheel zoom steps to small

5 participants